Skip to content

Conversation

@ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented Oct 14, 2025

We've had recurring issues with PRs' CHANGELOG.md entries going stale, particularly when PRs are filed close to a regular release date. This PR tries to make this by creating a CI check that fails when a PR modifies the changelog and it detects changes outside the ## Unreleased section header.

This is an MVP that is not yet suitable as a required check, because there is no escape hatch for cases where we do want to change released changelog content. The intent is to enable this once some follow-up to add such an escape hatch has achieved consensus and is implemented.

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch 7 times, most recently from 58ba751 to 8b3d6ff Compare October 14, 2025 20:41
@ErichDonGubler
Copy link
Member Author

Recent violators of the check I'm adding here that I had to fix in #8407:

@ErichDonGubler
Copy link
Member Author

Sigh, this check is running into issues with GitHub's default checkout action machinery wanting to be as shallow as possible. The "easy" fix here is not to use shallow repository checkouts. We'll want follow-up to see if there's a way to only check out what's necessary, but that's sort of a catch-22 unless we use the GitHub API (which I'd strongly prefer to avoid, so folks can run things locally offline).

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch 5 times, most recently from 556a765 to e686fa7 Compare October 22, 2025 19:23
@ErichDonGubler
Copy link
Member Author

I have several PRs demonstrating that core logic works here:

These are present in the check's unit tests in xtask, so I'm not worried about regressions in the future. 😁

There are some questions that are still open for this, but none are blocking until we make this check required:

  • What escape hatch should we use when we need this, i.e., our typos database is updated, and we correct an old CHANGELOG entry, and we want the PR to land? It's pretty easy to use a label, i.e., changelog: released entry changed, to control this. I suggest we do that.

    We don't need to resolve this right now, because it's only important if we make this a required check. I don't see that as necessary for a first iteration.

  • What fancy GitHub integration do we want? I can see several things that look interesting:

    • Step summary
    • Warning/error messages on end file contents of the PR

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch 6 times, most recently from c13a16a to 8f102f2 Compare October 22, 2025 19:53
@@ -0,0 +1,42 @@
name: Check `CHANGELOG.md`
Copy link
Member Author

@ErichDonGubler ErichDonGubler Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding for the file's name welcome!

changelog:
timeout-minutes: 1

name: Check `CHANGELOG` for errors
Copy link
Member Author

@ErichDonGubler ErichDonGubler Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding for the job's name welcome!

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch 3 times, most recently from 06acbe0 to 7ea2757 Compare October 22, 2025 21:48
@cwfitzgerald cwfitzgerald self-requested a review November 5, 2025 16:20
@cwfitzgerald cwfitzgerald self-assigned this Nov 5, 2025
@ErichDonGubler
Copy link
Member Author

From today's maintainers' meeting notes:

  • #8351 Check that PRs' CHANGELOG.md changes don't modify already-released content in CI (By Erich Gubler; Unassigned)
    • EG: This is coming, and it won’t immediately annoy people in CI, but the intent is to add another required check.
    • Consensus: All: Let’s land, as a required check.

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch from 7ea2757 to 8d83828 Compare November 5, 2025 19:34
@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch from 8d83828 to 8554263 Compare November 5, 2025 19:50

#[cfg(test)]
mod test_hunks_in_a_released_section {
#[collapse_debuginfo(yes)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What dafaq is this?

Copy link
Member Author

@ErichDonGubler ErichDonGubler Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a dissting!

When macros are used outside the crate defining them, this is the default. Within a crate, however, compiler errors spans, by default, will point to expanded code, not use sites. I felt it was nicer to do this from a testing standpoint, but it's not absolutely necessary, as the tests are working.

I just noticed we don't seem to have coverage for xtask unit tests in CI… 🤔

EDIT: That's not right, sigh.

This comment was marked as outdated.

use pico_args::Arguments;
use xshell::Shell;

pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a check to make sure your working state isn't dirty? Is this destructive to the working copy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might, but I don't know if it's worth handling the complexity. Could you tell me what scenario you're trying to prevent?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Do changes
  • "I wonder if I did the changelog right"
  • cargo xtask changelog
  • Where changes?
  • enters rage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I think that case should be handled just fine by the user not specifying the <to_commit> positional argument, in which case the CHANGELOG.md in the filesystem is used. Does that sound like it works?

To more definitively answer your question, there's no mutation of the working copy happening here.

@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch 4 times, most recently from dfc1280 to dc8340a Compare November 5, 2025 20:36
@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-glitchy-unique-tambourine branch from dc8340a to c37e504 Compare November 6, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants